package com.leyou.item.api;

import com.leyou.item.pojo.SpecGroup;
import com.leyou.item.pojo.SpecParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author CHERRY
 * @date 2018-09-08-0:11
 */
@RequestMapping("spec")
public interface SpecificationApi {
    /**
     * 查询规格参数
     *
     * @param cid       分类
     * @param gid       组
     * @param searching 是否搜索
     * @param generic   是否通用
     * @return
     */
    @GetMapping("params")
    List<SpecParam> querySpecParamByCid(
            @RequestParam(value = "cid", required = false) Long cid,
            @RequestParam(value = "gid", required = false) Long gid,
            @RequestParam(value = "searching", required = false) Boolean searching,
            @RequestParam(value = "generic", required = false) Boolean generic
    );

    /**
     * 根据分类查询组和规格参数数据
     *
     * @param cid
     * @return
     */
    @GetMapping("{cid}")
    List<SpecGroup> querySpecGroupAndSpecParamsByCid(@PathVariable("cid") Long cid);
}
